package cn.zglbk;

import cn.zglbk.generator.scan.SpringControllerScan;

//@SpringBootApplication
public class BoarApplication {

    public static void main(String[] args) {
//        ApplicationContext context = SpringApplication.run(BoarApplication.class, args);
//        SpringControllerScan scan = context.getBean(SpringControllerScan.class);
//        scan.init();
        SpringControllerScan.generatorTable("cn.zglbk");
        SpringControllerScan.generatorCsBroadcast("cn.zglbk");
//        DispatchGameMessageService.scanGameMessages(context, 1, "cn.zglbk");
//        GatewayServerBoot serverBoot = context.getBean(GatewayServerBoot.class);
//        serverBoot.startServer();
//
//
//        ServerConfig serverConfig = context.getBean(ServerConfig.class);//获取配置的实例
//        DispatchGameMessageService.scanGameMessages(context, serverConfig.getServiceId(), "com.mygame");// 扫描此服务可以处理的消息
//        GatewayMessageConsumerService gatewayMessageConsumerService = context.getBean(GatewayMessageConsumerService.class);//获取网关消息监听实例
//        //PlayerDao playerDao = context.getBean(PlayerDao.class);//获取Player数据操作类实例
//        AsyncPlayerDao playerDao = context.getBean(AsyncPlayerDao.class);
//        DispatchGameMessageService dispatchGameMessageService= context.getBean(DispatchGameMessageService.class);
//        DispatchUserEventService dispatchUserEventService = context.getBean(DispatchUserEventService.class);
//
//        gatewayMessageConsumerService.start((gameChannel) -> {//启动网关消息监听，并初始化GameChannelHandler
//            // 初始化channel
//            gameChannel.getChannelPiple().addLast(new GameChannelIdleStateHandler(300, 300, 300));
//            gameChannel.getChannelPiple().addLast(new GameBusinessMessageDispatchHandler(context,serverConfig,dispatchGameMessageService,dispatchUserEventService, playerDao));
//        });
    }

}
